while True:
    print("1.登录系统")
    str = input("请输入序列号进行操作:")
    list = [('root', '123456')]
    sp = (['芒果', 20, '香蕉', 10, '西瓜', 50])
    sp_1 = []
    # for i in list[0][0]:
    a = input('请输入用户名:')
    b = input('请输入密码:')
    if a == list[0][0]:
        if b == list[0][1]:
            print('登陆成功')
            sum  = input("您需要充值多少钱:")
            sum = int(sum)
            for i in sp:
                print("商品列表:")
                print(sp)
                choices = input("请输入想买的商品名称(按q退出,按w查看购买清单):")
                if choices != 'q':
                    if choices != 'w':
                        if choices == '芒果':
                            sp_1.append(choices)
                            print(f"你还剩下{sum-20}元")
                            sum -= 20
                        elif choices == '香蕉':
                            sp_1.append(choices)
                            print(f"你还剩{sum-10}元")
                            sum -= 10
                        elif choices =='西瓜':
                            sp_1.append(choices)
                            print(f"你还剩{sum-50}")
                            sum -= 50
                        else:
                            print("请输入正确的商品")
                    else:
                        print('购物清单:')
                        print(sp_1)
                else:
                    print("退出成功")
                    break
        else:
            print('密码错误')
    else:
        print('用户名输入错误')
